Language: Cpp
BasedOnStyle: Chromium

# Indentation
# There might be other settings we'd like to specify here, we'll see
TabWidth:        4
UseTab:          Always
AccessModifierOffset: -4
IndentCaseLabels: true
IndentWidth:     4
# Interesting options we should keep an eye out in the next release:
# this is currently overridden by BS_Allman in version 11, but hope they'll
# change it
# IndentExternBlock: NoIndent

# We really want BS_Allman, but we want to unindent extern "C"
# Once LLVM 11 is released, see if IndentExternBlock: NoIndent works

# BreakBeforeBraces: Allman
BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel:  true
  AfterClass:      true
  AfterControlStatement: true
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  true
  AfterObjCDeclaration: true
  AfterStruct:     true
  AfterUnion:      true
  AfterExternBlock: false
  BeforeCatch:     true
  BeforeElse:      true
  IndentBraces:    false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true


AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: true

BinPackParameters: true
BreakBeforeBinaryOperators: None
ConstructorInitializerAllOnOneLineOrOnePerLine: true

DerivePointerAlignment: false
MaxEmptyLinesToKeep: 3
PointerAlignment: Right
SpaceAfterCStyleCast: true
SpacesBeforeTrailingComments: 2

SortIncludes: true
IncludeBlocks:   Regroup
IncludeCategories:
  - Regex:           '^<ext/.*\.h>'
    Priority:        2
  - Regex:           '^<.*\.h>'
    Priority:        1
  - Regex:           '^<.*'
    Priority:        2
  - Regex:           '"postgres\.h"'
    Priority: -1
  - Regex:           '"gpos/.*'
    Priority:        3
  - Regex:           '"(gpopt|naucrates|gpdbcost)/.*'
    Priority:        4

# TODO: reflow comments
# when we get to it, should probably bite the bullet and add a bunch of no-lint
# comment around problematic areas
ReflowComments: false

# TODO: break literal strings, once we resolve Wstring-concatenation
BreakStringLiterals: false
